<clr-datagrid [clrDgLoading]="loading" [(clrDgSelected)]="selected">
    <clr-dg-action-bar>
        <div class="btn-group">
            <button type="button" class="btn btn-sm btn-secondary" (click)="onCreate()">
                <clr-icon shape="plus" size="16"></clr-icon>
                {{"APP_ADD"|translate}}
            </button>
            <button type="button" class="btn btn-sm btn-secondary" (click)="onDelete()" [disabled]="selected.length<1">
                <clr-icon shape="close"></clr-icon>
                {{"APP_DELETE"|translate}}
            </button>
        </div>
    </clr-dg-action-bar>
    <clr-dg-column>ID</clr-dg-column>
    <clr-dg-column>{{"APP_START_TIME"|translate}}</clr-dg-column>
    <clr-dg-column>{{"APP_END_TIME"|translate}}</clr-dg-column>
    <clr-dg-column>{{"APP_STATUS"|translate}}</clr-dg-column>
    <clr-dg-column>{{"APP_CREATED_DATE"|translate}}</clr-dg-column>

    <clr-dg-row *clrDgItems="let item of items" [clrDgItem]="item">
        <clr-dg-cell>
            <span *ngIf="item.status==='Success'">
                 <a href="javascript:void(0)" (click)="onDetail(item)">{{item.id}}</a>
            </span>
            <span *ngIf="item.status!=='Success'">
               {{item.id}}
            </span>
        </clr-dg-cell>
        <clr-dg-cell>{{item.startTime|date:'yyyy-MM-dd HH:mm:ss'}}</clr-dg-cell>
        <clr-dg-cell>
            <span *ngIf="item.status!=='Running'">
                {{item.endTime|date:'yyyy-MM-dd HH:mm:ss'}}
            </span>
            <span *ngIf="item.status==='Running'">
                -
            </span>
        </clr-dg-cell>
        <clr-dg-cell>

            <clr-spinner clrAssertive clrInline
                         *ngIf="item.status === 'Running'">
                Loading...
            </clr-spinner>
            {{item.status|translate}}
        </clr-dg-cell>
        <clr-dg-cell>{{item.createdAt|date:'yyyy-MM-dd HH:mm:ss'}}</clr-dg-cell>
    </clr-dg-row>

    <clr-dg-footer>
        <clr-dg-pagination #pagination [(clrDgPage)]="page" [clrDgPageSize]="size" [clrDgTotalItems]="total"
                           (clrDgPageChange)="refresh()">
            {{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
            {{"APP_PAGER_TOTAL"|translate}} {{pagination.totalItems}} {{"APP_TASK"|translate}}
        </clr-dg-pagination>
    </clr-dg-footer>
</clr-datagrid>

